package com.qf.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.mapper.DetailMapper;
import com.qf.pojo.NewsDetail;
import com.qf.service.DetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DetailServiceImpl implements DetailService {

    @Autowired
    DetailMapper detailMapper;


    @Override
    public Integer deleteById(Integer id) {

       Integer count= detailMapper.deleteByPrimaryKey(id);
        return count;
    }

    @Override
    public PageInfo<NewsDetail> pageinfo(Integer page, Integer size,String name) {

        PageHelper.startPage(page, size);

        List<NewsDetail> commentList = detailMapper.selectByName(name);
        PageInfo pageInfo=new PageInfo(commentList);

        return pageInfo;
    }
}
